<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
.parent, .child {
    -moz-user-select: none;
    -webkit-user-select: none;
}
.child {
    visibility: hidden;
}
</style>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p> Mouse double/triple click on an element with "webkit-user-select none" should not select the next node</p>
<div>
<div class='parent'>
  <div id="second" class='child'>1</div>
  <div class='child'>2</div>
  <div class='child'>3</div>
  <div class='child'>4</div>
</div>
Foo
</div>
<div id="console"></div>
<script>
function doubleClick() {
    eventSender.mouseDown();
    eventSender.mouseUp();
    eventSender.mouseDown();
    eventSender.mouseUp();
}

function tripleClick() {
    eventSender.mouseDown();
    eventSender.mouseUp();
    eventSender.mouseDown();
    eventSender.mouseUp();
    eventSender.mouseDown();
    eventSender.mouseUp();
}

if (window.eventSender) {
    var div = document.getElementById("second");
    var x = div.offsetLeft + 5;
    var y = div.offsetTop + 5;
    eventSender.mouseMoveTo(x, y);

    shouldNotBe("doubleClick(); document.getSelection()",'"Foo"');

    shouldBe('document.getSelection().removeAllRanges(); document.getSelection().toString().indexOf("Foo")','-1');

    shouldBe('tripleClick(); document.getSelection().toString().indexOf("Foo")', '-1');
} else {
    debug("To test manually, double/triple click on 1/2/3/4 and it should not select Foo");
}
successfullyParsed = true;
</script>
</body>
</html>
